package pers.xiaoliang.concurrency.example.singleton;

import lombok.extern.slf4j.Slf4j;
import pers.xiaoliang.concurrency.annotation.NotThreadSafe;

/**
* @description: 单例发布对象(懒汉模式- 线程不安全)
* @author: xiaoliang.liu
* @date: 2018/7/28 13:36
* @version v1.0
*/
@Slf4j
@NotThreadSafe
public class SingletonExample1 {

    private SingletonExample1 () {}


    /** 单例对象 */
    private static SingletonExample1 instance = null;

    /** 静态工厂方法 */
    public static SingletonExample1 getInstance() {
        if (instance == null) {
            instance = new SingletonExample1();
        }
        return instance;
    }

    public static void main(String[] args) {

    }
}
